package com.stx.friends.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;

import com.stx.friends.dao.RelationDao;
import com.stx.friends.entity.RelationEntity;
import com.stx.friends.service.RelationService;
import com.stx.friends.vo.RelationVo;

public class RelationServiceImpl implements RelationService {

	private RelationDao dao = null;

	public List<RelationVo> list(RelationVo criteria) {

		List<RelationVo> voList = new ArrayList<RelationVo>();

		List<RelationEntity> entityList = dao.list(criteria);

		for (RelationEntity entity : entityList) {

			RelationVo vo = new RelationVo();

			// 对象属性值拷贝 entity => vo
			BeanUtils.copyProperties(entity, vo);

			voList.add(vo);

		}

		return voList;
	}

	@Override
	public void delRelation(String wrxUid) {
		
		dao.delRelation(wrxUid);

	}
	@Override
	public void addRelation(RelationVo relation) {
		
		dao.addRelation(relation);
		
	}

	public void setDao(RelationDao dao) {
		this.dao = dao;
	}



}
